package io.renren.modules.ht.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.modules.cw.dao.CwRoomDao;
import io.renren.modules.cw.entity.CwRoomEntity;
import io.renren.modules.cw.service.CwRoomService;
import io.renren.modules.ht.dao.ContractsDao;
import io.renren.modules.ht.entity.ContractsEntity;
import io.renren.modules.ht.service.ContractsService;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service("contractsService")
public class ContractsServiceImpl extends ServiceImpl<ContractsDao, ContractsEntity> implements ContractsService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<ContractsEntity> wrapper = new QueryWrapper<>();
        if(params.get("contractName")!=null){
            wrapper.like("contract_name",params.get("contractName").toString().trim());
        }if(params.get("party2Name")!=null){
            wrapper.like("party2_name",params.get("party2Name").toString().trim());
        }
        IPage<ContractsEntity> page = this.page(
                new Query<ContractsEntity>().getPage(params),
                wrapper
        );

        return new PageUtils(page);
    }

}